<template>
  <div class="AuditRecords">
    <DicTable
        height="100%"
        stripe
        highlight-current-row
        highlight-hover-row
        max-height="600"
        ref="GBLtable"
        border
        header-row-class-name="header-row-class"
        row-class-name="ne-row-class"
        :columnData="GBLtbs.tableColumns"
        :tableData="GBLtbs.tableData"
        :loading="GBLtbs.tableLoading"
        :currentPage="~~GBLtbs.tablePage.pageIndex"
        :pageSize="~~GBLtbs.tablePage.pageSize"
        :totalResult="~~GBLtbs.tablePage.rowCount"
        :pager="true"
        @on-page-change="handlePageChange"
        :tableTooltipConfig="GBLtbs.tableTooltipConfig"
    >
    </DicTable>
  </div>
</template>
<script>
import DicTable from "@/components/public/DicTable";
import CustOrderService from "@/api/order/CustOrderService";
import { mapState } from "vuex";
export default {
  name: "AuditRecords",
  data() {
    return {
      GBLtbs: {
        tableColumns: [
          { field: "rowNum", title: "序号",width: '5%'},
          { field: "audType", title: "审核类型"},
          { field: "orderStateCd", title: "单据阶段"},
          { field: "custSoNumber", title: "流水号",width:'10%'},
          { field: "sendAudDate", title: "送审核时间",width: '10%'},
          { field: "reqAudName", title: "要求审核单位/人",width: '10%'},
          { field: "audName", title: "审核人姓名"},
          { field: "audComment", title: "审核意见",width: '10%'},
          { field: "audResult", title: "审核情况",width: '10%'},
          { field: "audDate", title: "审核时间",width: '10%'}
        ],
         tableTooltipConfig: {
                contentMethod: ({ type, column, row, items, _columnIndex }) => {
              
                  // 重写默认的提示内容
                  if (column.property === 'audComment') {
                    
                    return  row[column.property]
                  }
                },
                showAll: true,
                enterable: true,
              },
        tableData:  [],
        tableLoading: false,
        tablePage: {
          pageIndex: 1,
          pageSize: 10,
          rowCount: 0,
        },
      }
    }
  },
  props: {
    CTOInfo: {
      type: Object
    }
  },
  
  mounted() {

  },
  created() {
    this.getList();
  },
  components: {DicTable},
  computed: {
    ...mapState("user", ["user"]),
  },
  methods: {
    async getList(){
    let{custSoNumber,batchNbr,custId} = this.CTOInfo,
      pageInfo={
          pageIndex: ~~this.GBLtbs.tablePage.pageIndex+'',
          pageSize: ~~this.GBLtbs.tablePage.pageSize+''
        },
        params = {custSoNumber,batchNbr,custId,pageInfo:pageInfo};
        const result = await CustOrderService.qryAuditDemandOrder(params);
        if(result.meta.resultCode=='0' || !result.meta.resultCode){
          this.GBLtbs.tableData = result.meta.orderItemAudits;
          this.GBLtbs.tablePage = {
                pageIndex: ~~Number(result.meta.pageInfo.pageIndex),
                pageSize: ~~Number(result.meta.pageInfo.pageSize),
                rowCount: ~~Number(result.meta.pageInfo.rowCount)
          };
        }else{
          this.$message({
            showClose: true,
            message: result.meta.resultMsg,
            type: 'error'
          });
        }
    },
    handlePageChange({ currentPage, pageSize }) {
      this.GBLtbs.tablePage.pageIndex = currentPage;
      this.GBLtbs.tablePage.pageSize = pageSize;
      this.getList();
    }

  }
}
</script>

<style lang="scss" scoped>

</style>
